package com.example.loginpilot_01.service.announcement;

import com.example.loginpilot_01.entity.Announcement;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AnnouncementRepository extends JpaRepository<Announcement, Integer> {
    // 按发布时间倒序查询所有公告（最新的在前）
    List<Announcement> findAllByOrderByPublishTimeDesc();
    // 按是否置顶（降序）+ 发布时间（降序）查询（置顶的在前，同置顶按时间排序）
    List<Announcement> findAllByOrderByIsTopDescPublishTimeDesc();
}